﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Unity.Errors.types;

namespace DbGenerator.Resources.dicts
{
    public enum ESqlObjectType : byte
    {
        DEFAULTKEY,
        FOREIGNKEY,
        FUNCTION,
        SPROC,
        PRIMARYKEY,
        TABLE,
        UNIQUEKEY,
        VIEW
    }

    public static class SSqlObjectTypes
    {
        static SSqlObjectTypes()
        {
            _Dict = new Dictionary<ESqlObjectType, string>()
            {
                {ESqlObjectType.DEFAULTKEY, "D"},
                {ESqlObjectType.FOREIGNKEY, "F"},
                {ESqlObjectType.FUNCTION, "IF"},
                {ESqlObjectType.SPROC, "P"},
                {ESqlObjectType.PRIMARYKEY, "PK"},
                {ESqlObjectType.TABLE, "U"},
                {ESqlObjectType.UNIQUEKEY, "UQ"},
                {ESqlObjectType.VIEW, "V"},
            };
        }
        private static Dictionary<ESqlObjectType, string> _Dict;
        public static string Get(ESqlObjectType key)
        {
            SErrorManager.Errors("KeyNotFound")
                .Assert(_Dict.ContainsKey(key)
                , new TErrorInfo(typeof(SSqlObjectTypes), "Get")
                , key);
            return _Dict[key];
        }
    }
}
